use axum::{
    routing::{delete, get, post, put},
    Router,
};
mod address_book;
mod order;
mod shoppingcart;
pub mod user;
use address_book::addressbook_router;
use order::user_order_router;
use shoppingcart::shoppingcart_router;
use user::user_router;

use crate::bootstrap::AppState;
use crate::controller::user as controller_user;

pub fn users_router(state: &AppState) -> Router<AppState> {
    let route = Router::new()
        // C端-用户接口
        .nest("/user", user_router(state))
        // C端-地址簿接口
        .nest("/addressBook", addressbook_router(state))
        // C端-购物车接口
        .nest("/shoppingCart", shoppingcart_router(state))
        // C端-店铺操作接口
        .route("/shop/status", get(controller_user::shop::get_shop_status))
        // C端-分类接口
        .route(
            "/category/list",
            get(controller_user::category::list_by_type),
        )
        // C端-套餐浏览接口
        .route(
            "/setmeal/list",
            get(controller_user::setmeal::list_category_id),
        )
        .route(
            "/setmeal/dish/:id",
            get(controller_user::setmeal::dish_list),
        )
        // C端-菜品浏览接口
        .route("/dish/list", get(controller_user::dish::list))
        // C端-购物接口
        .nest("/order", user_order_router(state))
        .with_state(state.clone());
    route
}
